package com.svse.designPattern.structure.proxy.impl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @Date 2020/7/31 8:34
 */
public class ProxyHandler implements InvocationHandler {
    private Object object;
    public ProxyHandler(Object object){
        this.object = object;
    }
    @Override
    public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
        System.out.println("Before invoke  className: "  +object.getClass().getName()+"  methodName: "+ method.getName());
        method.invoke(object, args);
        System.out.println("After invoke  className: "   +object.getClass().getName() +" methodName: "+ method.getName());
        return null;
    }
}
